import {reqCategoryList} from '@/api'

const state = {
	// 商品分类的数据,这里是初始化数据不能随意更改
	categoryList: []
}

const mutations = {
	// 操作state里面的数据
	GETCATEGHORY(state,category){
		// 修改state
		state.categoryList = category
	}
}

const actions = {
	// 获取商品分类的数据
	async getCategory({commit}){
		let result = await reqCategoryList();
		console.log(result)
		if(result.code == 200){
			commit('GETCATEGHORY',result.data)
		}
	}
}

const getters = {

}

export default ({
	state,
	mutations,
	actions,
	getters
})